/**
 *
 */
import OpenApi;
import OpenApi.OpenApiUtil;

extends OpenApi;


init(config: OpenApiUtil.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('milvus', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!$isNull(endpoint)) {
    return endpoint;
  }
  
  if (!$isNull(endpointMap) && !$isNull(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return OpenApiUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model CreateDefaultRoleResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', example='{ "PolicyType": "AccountLevelIdentityBasedPolicy", "AuthPrincipalOwnerId": "xxxx", "EncodedDiagnosticMessage": "xxxx", "AuthPrincipalType": "SubUser", "AuthPrincipalDisplayName": "xxxx", "NoPermissionType": "ImplicitDeny", "AuthAction": "milvus:xxxx" }'),
  data?: boolean(name='Data', example='true'),
  errCode?: string(name='ErrCode', example='Instance.NotFound'),
  errMessage?: string(name='ErrMessage', example='Failed to find instance c-123xxx'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  requestId?: string(name='RequestId', example='ABCD-1234-5678-EFGH'),
  success?: boolean(name='Success', example='true'),
}

model CreateDefaultRoleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateDefaultRoleResponseBody(name='body'),
}

/**
 * @summary 为用户创建AliyunServiceRoleForMilvus
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateDefaultRoleResponse
 */
async function createDefaultRoleWithOptions(headers: map[string]string, runtime: $RuntimeOptions): CreateDefaultRoleResponse {
  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApiUtil.Params{
    action = 'CreateDefaultRole',
    version = '2023-10-12',
    protocol = 'HTTPS',
    pathname = `/webapi/user/create_default_role`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 为用户创建AliyunServiceRoleForMilvus
 *
 * @return CreateDefaultRoleResponse
 */
async function createDefaultRole(): CreateDefaultRoleResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return createDefaultRoleWithOptions(headers, runtime);
}

model DescribeAccessControlListRequest {
  instanceId?: string(name='InstanceId', example='c-123xxx'),
}

model DescribeAccessControlListResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', example='{     "PolicyType": "AccountLevelIdentityBasedPolicy",     "AuthPrincipalOwnerId": "xxxx",     "EncodedDiagnosticMessage": "xxxx",     "AuthPrincipalType": "SubUser",     "AuthPrincipalDisplayName": "xxxx",     "NoPermissionType": "ImplicitDeny",     "AuthAction": "milvus:xxxx" }'),
  data?: {
    aclId?: string(name='AclId', example='acl-xxxx'),
    cidr?: [ string ](name='Cidr'),
  }(name='Data'),
  errMessage?: string(name='ErrMessage', example='Failed to find instance c-123xxx'),
  errorCode?: string(name='ErrorCode', example='Instance.NotFound'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  requestId?: string(name='RequestId', example='ABCD-1234-5678-EFGH'),
  success?: boolean(name='Success', example='true'),
}

model DescribeAccessControlListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeAccessControlListResponseBody(name='body'),
}

/**
 * @summary 获取Milvus公网访问ACL信息
 *
 * @param request DescribeAccessControlListRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeAccessControlListResponse
 */
async function describeAccessControlListWithOptions(request: DescribeAccessControlListRequest, headers: map[string]string, runtime: $RuntimeOptions): DescribeAccessControlListResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeAccessControlList',
    version = '2023-10-12',
    protocol = 'HTTPS',
    pathname = `/webapi/milvus/describe_access_control_list`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取Milvus公网访问ACL信息
 *
 * @param request DescribeAccessControlListRequest
 * @return DescribeAccessControlListResponse
 */
async function describeAccessControlList(request: DescribeAccessControlListRequest): DescribeAccessControlListResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return describeAccessControlListWithOptions(request, headers, runtime);
}

model DescribeInstanceConfigsRequest {
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='c-123xxx'),
}

model DescribeInstanceConfigsResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', example='{     "PolicyType": "AccountLevelIdentityBasedPolicy",     "AuthPrincipalOwnerId": "xxxx",     "EncodedDiagnosticMessage": "xxxx",     "AuthPrincipalType": "SubUser",     "AuthPrincipalDisplayName": "xxxx",     "NoPermissionType": "ImplicitDeny",     "AuthAction": "milvus:xxxx" }'),
  data?: bytes(name='Data', example='dataCoord:\\\\n  enableCompaction: true'),
  errCode?: string(name='ErrCode', example='Instance.NotFound'),
  errMessage?: string(name='ErrMessage', example='Failed to find instance c-123xxx.'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  requestId?: string(name='RequestId', example='ABCD-1234-5678-EFGH'),
  success?: boolean(name='Success', example='true'),
}

model DescribeInstanceConfigsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeInstanceConfigsResponseBody(name='body'),
}

/**
 * @summary 查询实例用户配置
 *
 * @param request DescribeInstanceConfigsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeInstanceConfigsResponse
 */
async function describeInstanceConfigsWithOptions(request: DescribeInstanceConfigsRequest, headers: map[string]string, runtime: $RuntimeOptions): DescribeInstanceConfigsResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeInstanceConfigs',
    version = '2023-10-12',
    protocol = 'HTTPS',
    pathname = `/webapi/config/describe_milvus_user_config`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 查询实例用户配置
 *
 * @param request DescribeInstanceConfigsRequest
 * @return DescribeInstanceConfigsResponse
 */
async function describeInstanceConfigs(request: DescribeInstanceConfigsRequest): DescribeInstanceConfigsResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return describeInstanceConfigsWithOptions(request, headers, runtime);
}

model GetInstanceDetailRequest {
  instanceId?: string(name='InstanceId', example='c-123xxx'),
}

model GetInstanceDetailResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', example='{     "PolicyType": "AccountLevelIdentityBasedPolicy",     "AuthPrincipalOwnerId": "xxxx",     "EncodedDiagnosticMessage": "xxxx",     "AuthPrincipalType": "SubUser",     "AuthPrincipalDisplayName": "xxxx",     "NoPermissionType": "ImplicitDeny",     "AuthAction": "milvus:xxxx" }'),
  data?: {
    aclId?: string(name='AclId', example='acl-123xxx'),
    beginTime?: long(name='BeginTime', example='1716863508000'),
    bucketName?: string(name='BucketName', example='milvus-test'),
    bucketPath?: string(name='BucketPath', example='https://oss.console.aliyun.com/bucket/oss-cn-beijing/xxxx/object?spm=a2cug.25127996.0.0.577990370Ebsqt&path=milvus-c-123xxxx'),
    clusterInfo?: {
      attuPort?: int32(name='AttuPort', example='3000'),
      internetUrl?: string(name='InternetUrl', example='c-123xxx-.milvus.aliyuncs.com'),
      intranetUrl?: string(name='IntranetUrl', example='c-123xxx-internal.milvus.aliyuncs.com'),
      milvusResourceInfoList?: [ 
        {
          componentType?: string(name='ComponentType', example='QueryNode'),
          cuNum?: int32(name='CuNum', example='8'),
          cuRatio?: int32(name='CuRatio'),
          diskSize?: int32(name='DiskSize', example='100'),
          diskType?: string(name='DiskType', example='essd'),
          replica?: int32(name='Replica', example='2'),
        }
      ](name='MilvusResourceInfoList'),
      ossStorageSize?: string(name='OssStorageSize', example='125.15 GB'),
      ossStorageTimestamp?: long(name='OssStorageTimestamp', example='1718604000000'),
      proxyPort?: int32(name='ProxyPort', example='19530'),
      totalCuNum?: int32(name='TotalCuNum', example='24'),
      totalDiskSize?: int32(name='TotalDiskSize', example='500'),
    }(name='ClusterInfo'),
    clusterName?: string(name='ClusterName', example='aliyun-test'),
    enableHa?: boolean(name='EnableHa'),
    expireTime?: long(name='ExpireTime', example='1721664000000'),
    instanceId?: string(name='InstanceId', example='c-123xxx'),
    instanceStatus?: string(name='InstanceStatus', example='running'),
    measureConfig?: {
      dataNodeCuNum?: int32(name='DataNodeCuNum'),
      dataNodeReplica?: int32(name='DataNodeReplica'),
      indexNodeCuNum?: int32(name='IndexNodeCuNum'),
      indexNodeReplica?: int32(name='IndexNodeReplica'),
      mixCoodinatorNodeCuNum?: int32(name='MixCoodinatorNodeCuNum'),
      mixCoodinatorNodeReplica?: int32(name='MixCoodinatorNodeReplica'),
      proxyNodeCuNum?: int32(name='ProxyNodeCuNum'),
      proxyNodeReplica?: int32(name='ProxyNodeReplica'),
      queryNodeCuNum?: int32(name='QueryNodeCuNum'),
      queryNodeReplica?: int32(name='QueryNodeReplica'),
    }(name='MeasureConfig'),
    nodeType?: string(name='NodeType'),
    openPublicNet?: boolean(name='OpenPublicNet', example='true'),
    packageType?: string(name='PackageType', example='standard'),
    payType?: int32(name='PayType', example='1'),
    productCode?: string(name='ProductCode', example='milvus_milvuspre_public_cn'),
    regionId?: string(name='RegionId', example='cn-beijing'),
    resourceGroupId?: string(name='ResourceGroupId', example='rg-123xxx'),
    runningTime?: long(name='RunningTime', example='1743679'),
    sgId?: string(name='SgId', example='sg-123xxx'),
    tags?: [ 
      {
        key?: string(name='Key'),
        value?: string(name='Value'),
      }
    ](name='Tags'),
    templateVersion?: string(name='TemplateVersion', example='2.4.1-1.0-0.0.1'),
    userConfig?: string(name='UserConfig', example='dataCoord:\\\\n  segment:\\\\n    maxSize: 1024'),
    version?: string(name='Version', example='2.4'),
    vpcId?: string(name='VpcId', example='vpc-123xxx'),
    vswId?: string(name='VswId', example='vsw-123xxx'),
    zoneId?: string(name='ZoneId', example='cn-beijing-g'),
  }(name='Data'),
  errCode?: string(name='ErrCode', example='Instance.NotFound'),
  errMessage?: string(name='ErrMessage', example='Failed to find instance c-123xxx'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  requestId?: string(name='RequestId', example='ABCD-1234-5678-EFGH'),
  success?: boolean(name='Success', example='true'),
}

model GetInstanceDetailResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetInstanceDetailResponseBody(name='body'),
}

/**
 * @summary 根据集群ID获取集群的详细信息
 *
 * @param request GetInstanceDetailRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetInstanceDetailResponse
 */
async function getInstanceDetailWithOptions(request: GetInstanceDetailRequest, headers: map[string]string, runtime: $RuntimeOptions): GetInstanceDetailResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetInstanceDetail',
    version = '2023-10-12',
    protocol = 'HTTPS',
    pathname = `/webapi/cluster/detail`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 根据集群ID获取集群的详细信息
 *
 * @param request GetInstanceDetailRequest
 * @return GetInstanceDetailResponse
 */
async function getInstanceDetail(request: GetInstanceDetailRequest): GetInstanceDetailResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getInstanceDetailWithOptions(request, headers, runtime);
}

model ListInstancesRequest {
  clusterId?: string(name='ClusterId', example='c-123xxx'),
  clusterName?: string(name='ClusterName', example='milvus-test'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  regionId?: string(name='RegionId', example='cn-beijing'),
  resourceGroupId?: string(name='ResourceGroupId', example='rg-123xxx'),
  tag?: [ 
    {
      key?: string(name='Key'),
      value?: string(name='Value'),
    }
  ](name='Tag'),
}

model ListInstancesShrinkRequest {
  clusterId?: string(name='ClusterId', example='c-123xxx'),
  clusterName?: string(name='ClusterName', example='milvus-test'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  regionId?: string(name='RegionId', example='cn-beijing'),
  resourceGroupId?: string(name='ResourceGroupId', example='rg-123xxx'),
  tagShrink?: string(name='Tag'),
}

model ListInstancesResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', example='{     "PolicyType": "AccountLevelIdentityBasedPolicy",     "AuthPrincipalOwnerId": "xxxx",     "EncodedDiagnosticMessage": "xxxx",     "AuthPrincipalType": "SubUser",     "AuthPrincipalDisplayName": "xxxx",     "NoPermissionType": "ImplicitDeny",     "AuthAction": "milvus:xxxx" }'),
  data?: [ 
    {
      autoBackup?: boolean(name='AutoBackup'),
      beginTime?: long(name='BeginTime', example='1718608505000'),
      clusterInfo?: {
        attuPort?: int32(name='AttuPort', example='3000'),
        internetUrl?: string(name='InternetUrl', example='c-123xxx.milvus.aliyuncs.com'),
        intranetUrl?: string(name='IntranetUrl', example='c-123xxx-internal.milvus.aliyuncs.com'),
        milvusResourceInfoList?: [ 
          {
            componentType?: string(name='ComponentType', example='standalone'),
            cuNum?: int32(name='CuNum', example='16'),
            diskSize?: int32(name='DiskSize', example='100'),
            diskType?: string(name='DiskType', example='essd'),
            replica?: int32(name='Replica', example='1'),
          }
        ](name='MilvusResourceInfoList'),
        proxyPort?: int32(name='ProxyPort', example='19530'),
        totalCuNum?: int32(name='TotalCuNum', example='24'),
        totalDiskSize?: int32(name='TotalDiskSize', example='500'),
      }(name='ClusterInfo'),
      clusterName?: string(name='ClusterName', example='milvus-test'),
      expireTime?: long(name='ExpireTime', example='1721232000000'),
      instanceId?: string(name='InstanceId', example='c-123xxx'),
      instanceStatus?: string(name='InstanceStatus', example='running'),
      nodeType?: string(name='NodeType'),
      openPublicNet?: boolean(name='OpenPublicNet', example='true'),
      packageType?: string(name='PackageType', example='trial'),
      payType?: int32(name='PayType', example='1'),
      productCode?: string(name='ProductCode', example='milvus_milvuspre_public_cn'),
      regionId?: string(name='RegionId', example='cn-beijing'),
      resourceGroupId?: string(name='ResourceGroupId', example='rg-123xxx'),
      runningTime?: int32(name='RunningTime', example='536611'),
      sgId?: string(name='SgId', example='sg-123xxx'),
      tags?: [ 
        {
          key?: string(name='Key'),
          value?: string(name='Value'),
        }
      ](name='Tags'),
      vpcId?: string(name='VpcId', example='vpc-123xxx'),
      vswId?: string(name='VswId', example='vsw-123xxx'),
      zoneId?: string(name='ZoneId', example='cn-beijing-g'),
    }
  ](name='Data'),
  errCode?: string(name='ErrCode', example='Instance.NotFound'),
  errMessage?: string(name='ErrMessage', example='Failed to find instance c-123xxx'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  requestId?: string(name='RequestId', example='ABCD-1234-5678-EFGH'),
  success?: boolean(name='Success', example='true'),
  total?: int32(name='Total', example='15'),
}

model ListInstancesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListInstancesResponseBody(name='body'),
}

/**
 * @summary 根据集群ID或者名称搜索集群
 *
 * @param tmpReq ListInstancesRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListInstancesResponse
 */
async function listInstancesWithOptions(tmpReq: ListInstancesRequest, headers: map[string]string, runtime: $RuntimeOptions): ListInstancesResponse {
  tmpReq.validate();
  var request = new ListInstancesShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.tag)) {
    request.tagShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.tag, 'Tag', 'json');
  }
  var query : map[string]any = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.clusterName)) {
    query['ClusterName'] = request.clusterName;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!$isNull(request.tagShrink)) {
    query['Tag'] = request.tagShrink;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListInstances',
    version = '2023-10-12',
    protocol = 'HTTPS',
    pathname = `/webapi/order/list`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 根据集群ID或者名称搜索集群
 *
 * @param request ListInstancesRequest
 * @return ListInstancesResponse
 */
async function listInstances(request: ListInstancesRequest): ListInstancesResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return listInstancesWithOptions(request, headers, runtime);
}

model ModifyInstanceConfigRequest {
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='c-123xxx'),
  reason?: string(name='Reason', description='This parameter is required.', example='for test'),
  userConfig?: string(name='UserConfig', example='dataCoord:\\\\n  segment:\\\\n    maxSize: 1024'),
}

model ModifyInstanceConfigResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', example='{     "PolicyType": "AccountLevelIdentityBasedPolicy",     "AuthPrincipalOwnerId": "xxxx",     "EncodedDiagnosticMessage": "xxxx",     "AuthPrincipalType": "SubUser",     "AuthPrincipalDisplayName": "xxxx",     "NoPermissionType": "ImplicitDeny",     "AuthAction": "milvus:xxxx" }'),
  data?: boolean(name='Data', example='true'),
  errCode?: string(name='ErrCode', example='Instance.NotFound'),
  errMessage?: string(name='ErrMessage', example='Failed to find instance c-123xxx'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  requestId?: string(name='RequestId', example='ABCD-1234-5678-EFGH'),
  success?: boolean(name='Success', example='true'),
}

model ModifyInstanceConfigResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyInstanceConfigResponseBody(name='body'),
}

/**
 * @summary 修改实例配置
 *
 * @param request ModifyInstanceConfigRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyInstanceConfigResponse
 */
async function modifyInstanceConfigWithOptions(request: ModifyInstanceConfigRequest, headers: map[string]string, runtime: $RuntimeOptions): ModifyInstanceConfigResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.reason)) {
    query['Reason'] = request.reason;
  }
  if (!$isNull(request.userConfig)) {
    query['UserConfig'] = request.userConfig;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyInstanceConfig',
    version = '2023-10-12',
    protocol = 'HTTPS',
    pathname = `/webapi/config/modify_milvus_config`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 修改实例配置
 *
 * @param request ModifyInstanceConfigRequest
 * @return ModifyInstanceConfigResponse
 */
async function modifyInstanceConfig(request: ModifyInstanceConfigRequest): ModifyInstanceConfigResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return modifyInstanceConfigWithOptions(request, headers, runtime);
}

model UpdateAccessControlListRequest {
  aclId?: string(name='AclId', example='acl-123xxx'),
  cidr?: string(name='Cidr', example='192.168.1.0/24,172.16.0.0/16'),
  instanceId?: string(name='InstanceId', example='c-123xxx'),
}

model UpdateAccessControlListResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', example='{     "PolicyType": "AccountLevelIdentityBasedPolicy",     "AuthPrincipalOwnerId": "xxxx",     "EncodedDiagnosticMessage": "xxxx",     "AuthPrincipalType": "SubUser",     "AuthPrincipalDisplayName": "xxxx",     "NoPermissionType": "ImplicitDeny",     "AuthAction": "milvus:xxxx" }'),
  data?: boolean(name='Data', example='true'),
  errMessage?: string(name='ErrMessage', example='The format of cidr is illegal.'),
  errorCode?: string(name='ErrorCode', example='ILLEGAL.MilvusCidrFormat'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  requestId?: string(name='RequestId', example='ABCD-1234-5678-EFGH'),
  success?: boolean(name='Success', example='true'),
}

model UpdateAccessControlListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateAccessControlListResponseBody(name='body'),
}

/**
 * @summary 更新Milvus公网访问ACL信息
 *
 * @param request UpdateAccessControlListRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateAccessControlListResponse
 */
async function updateAccessControlListWithOptions(request: UpdateAccessControlListRequest, headers: map[string]string, runtime: $RuntimeOptions): UpdateAccessControlListResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.aclId)) {
    query['AclId'] = request.aclId;
  }
  if (!$isNull(request.cidr)) {
    query['Cidr'] = request.cidr;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'UpdateAccessControlList',
    version = '2023-10-12',
    protocol = 'HTTPS',
    pathname = `/webapi/milvus/update_access_control_list`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 更新Milvus公网访问ACL信息
 *
 * @param request UpdateAccessControlListRequest
 * @return UpdateAccessControlListResponse
 */
async function updateAccessControlList(request: UpdateAccessControlListRequest): UpdateAccessControlListResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return updateAccessControlListWithOptions(request, headers, runtime);
}

model UpdateInstanceNameRequest {
  clusterName?: string(name='ClusterName', description='This parameter is required.', example='milvus-test'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='c-123xxx'),
}

model UpdateInstanceNameResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', example='{     "PolicyType": "AccountLevelIdentityBasedPolicy",     "AuthPrincipalOwnerId": "xxxx",     "EncodedDiagnosticMessage": "xxxx",     "AuthPrincipalType": "SubUser",     "AuthPrincipalDisplayName": "xxxx",     "NoPermissionType": "ImplicitDeny",     "AuthAction": "milvus:xxxx" }'),
  data?: boolean(name='Data', example='true'),
  errCode?: string(name='ErrCode', example='Instance.NotFound'),
  errMessage?: string(name='ErrMessage', example='Failed to find instance c-123xxx'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  requestId?: string(name='RequestId', example='ABCD-1234-5678-EFGH'),
  success?: boolean(name='Success', example='true'),
}

model UpdateInstanceNameResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateInstanceNameResponseBody(name='body'),
}

/**
 * @summary 修改集群名称
 *
 * @param request UpdateInstanceNameRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateInstanceNameResponse
 */
async function updateInstanceNameWithOptions(request: UpdateInstanceNameRequest, headers: map[string]string, runtime: $RuntimeOptions): UpdateInstanceNameResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.clusterName)) {
    query['ClusterName'] = request.clusterName;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'UpdateInstanceName',
    version = '2023-10-12',
    protocol = 'HTTPS',
    pathname = `/webapi/cluster/update_name`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 修改集群名称
 *
 * @param request UpdateInstanceNameRequest
 * @return UpdateInstanceNameResponse
 */
async function updateInstanceName(request: UpdateInstanceNameRequest): UpdateInstanceNameResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return updateInstanceNameWithOptions(request, headers, runtime);
}

model UpdatePublicNetworkStatusRequest {
  cidr?: string(name='Cidr'),
  componentType?: string(name='ComponentType', description='This parameter is required.', example='Proxy'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='c-123xxx'),
  publicNetworkEnabled?: boolean(name='PublicNetworkEnabled', description='This parameter is required.', example='true'),
}

model UpdatePublicNetworkStatusResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', example='{     "PolicyType": "AccountLevelIdentityBasedPolicy",     "AuthPrincipalOwnerId": "xxxx",     "EncodedDiagnosticMessage": "xxxx",     "AuthPrincipalType": "SubUser",     "AuthPrincipalDisplayName": "xxxx",     "NoPermissionType": "ImplicitDeny",     "AuthAction": "milvus:xxxx" }'),
  data?: boolean(name='Data', example='true'),
  errCode?: string(name='ErrCode', example='Failed to find instance'),
  errMessage?: string(name='ErrMessage', example='Failed to find instance c-123xxx'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  requestId?: string(name='RequestId', example='ABCD-1234-5678-EFGH'),
  success?: boolean(name='Success', example='true'),
}

model UpdatePublicNetworkStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdatePublicNetworkStatusResponseBody(name='body'),
}

/**
 * @summary 该接口用于开通/关闭 Proxy的公网SLB。
 *
 * @param request UpdatePublicNetworkStatusRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdatePublicNetworkStatusResponse
 */
async function updatePublicNetworkStatusWithOptions(request: UpdatePublicNetworkStatusRequest, headers: map[string]string, runtime: $RuntimeOptions): UpdatePublicNetworkStatusResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.cidr)) {
    query['Cidr'] = request.cidr;
  }
  if (!$isNull(request.componentType)) {
    query['ComponentType'] = request.componentType;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.publicNetworkEnabled)) {
    query['PublicNetworkEnabled'] = request.publicNetworkEnabled;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'UpdatePublicNetworkStatus',
    version = '2023-10-12',
    protocol = 'HTTPS',
    pathname = `/webapi/network/updatePublicNetworkStatus`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 该接口用于开通/关闭 Proxy的公网SLB。
 *
 * @param request UpdatePublicNetworkStatusRequest
 * @return UpdatePublicNetworkStatusResponse
 */
async function updatePublicNetworkStatus(request: UpdatePublicNetworkStatusRequest): UpdatePublicNetworkStatusResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return updatePublicNetworkStatusWithOptions(request, headers, runtime);
}

